package com.woniuxy.commons.config;

import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author wangyanhui
 * @date 2020/8/6 - 22:59
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    private ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .title("Api文档")
                .description("SwaggerAPI文档")
                .version("1.0")
                .contact(new Contact("springcloud","www.springcould.com" +
                        "","my@163.com"))
                .build();
    }

    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("webApi")
                .apiInfo(apiInfo())
                .select().build();
    }
}
